<template>
	<view class="house-list">
		<block v-if="list.length>0">
			
		
		<view class="house-item" v-for="(item, index) in list" :key="index">
			<view class="item-header">
				<text class="house-name" v-if="item.house" >{{(item.house.areaInfo)? item.house.areaInfo.replace(/#/g, "-"):"" }}{{ item.house.bankCard }}</text>
				<text class="owner-tag">{{ item.bindRoleName }}</text>
			</view>
			<view class="item-body">
				<view class="info-row">
					<text class="label">房屋建筑面积：</text>
					<text class="value">{{ item.house.houseSize || "-" }}m²</text>
				</view>
				<view class="info-row  u-m-t-30">
					<text class="label">绑定时间：</text>
					<text class="value">{{ item.bindDate}}</text>
				</view>
				<view class="info-row  u-m-t-30" v-if="item.house">
					<text class="label">地址：</text>
					<text class="value">{{ setAddress(item.house)}}</text>
				</view>
			</view>  	
		</view>
		</block>
		<block v-else>
			 <u-empty text="暂无绑定房屋" />
		</block>
		
	</view>
</template>

<script>
	
	export default {
		name: "house-list",
		props: {
			list: {
				type: Array,
				default: () => []
			},
			identityOptions: {
				type: Array,
				default: () => []
			}
		},
		computed: {
			
		},
		methods: {
			setAddress(item){
				let text=""
				console.log("item.areaInfo",item)
				if(item.areaInfo){
					text+=item.areaInfo
				}
				if(item.roomCode){
					text+=item.roomCode
				}
				return text
			},
			getIdentityLabel(value) {
				// let item=this.identityOptions.find(option => option.value == value)
				return item?item.label:'';
			}
		}
	}
</script>

<style scoped>
	.house-list {
		margin-top: 30rpx;
		padding-bottom: 30rpx;
	}

	.house-item {
		background: #FFFFFF;
		box-shadow: 0rpx 34rpx 144rpx 0rpx rgba(58,76,130,0.08), 0rpx 5rpx 14rpx 0rpx rgba(169,194,209,0.1);
		border-radius: 18rpx ;
		padding: 30rpx;
		margin-bottom: 20rpx;
	
	}

	.item-header {
		display: flex;
		align-items: center;
		margin-bottom: 30rpx;
	}

	.house-name {
		font-weight: 500;
		font-size: 34rpx;
		color: #333333;
	}

	.owner-tag {
		width: 64rpx;
		height: 34rpx;
		border-radius: 4rpx 4rpx 4rpx 4rpx;
		border: 1rpx solid #027AFF;
		font-weight: 400;
		font-size: 24rpx;
		color: #027AFF;
		margin-left: 16rpx;
		display: flex;
		align-items: center;
		justify-content: center;
	}

	.item-body .info-row {
		display: flex;
		font-size: 28rpx;
		font-weight: 400;
		
	}

	.item-body .label {
		width: 200rpx;
		color: #999999;
	}

	.item-body .value {
		color: #666666;
	}
</style> 